import http from '../utils/http.js';

let api = {}

/**
 * 用户登录
 */
api.userLogin = (params) => http.post(`/api/app/login/mpWeixin`, params, {
	isLoginRequest: true
})

/**
 * 用户手机号登录
 */
api.userLoginPhone = (params) => http.post(`/api/app/login/mpWeixinPhone`, params, {
	isLoginRequest: true
})

/**
 * 上传文件
 * {
 *	file:file,
 *	rootPath:rootPath
 *}
 */
api.upFile = (params) => http.uploadFile(`/api/app/file/up`, params)

/**
 * 获取用户信息
 */
api.userFindUserInfo = () => http.get(`/api/app/user/findUserInfo`)
/**
 * 修改手机号
 */
api.userUpdPhone = (params) => http.post(`/api/app/user/editPhone`, params)
/**
 * 修改用户资料
 */
api.userUpdInfo = (params) => http.post(`/api/app/user/editInfo`, params)


/**
 * 配置
 */
api.configByType = (type) => {
	return http.get(`/api/app/config/findByType/${type}`, null)
}

//页面数据
/**
 * 首页数据
 */
api.appPageIndex = () => http.get(`/api/app/page/index`)
/**
 * 我的数据
 */
api.appPageMe = () => http.get(`/api/app/page/me`)

/**
 * 常见问题
 */
api.appQAList = (params) => http.get(`/api/app/qa/findAllByList`, params)

/**
 * 意见反馈
 */
api.appFankuiAdd = (params) => http.post(`/api/app/fankui/add`, params)

/**
 * 字典
 */
api.appDictWeappFindAllByList = () => http.get(`/api/app/dict/findAllByList`)
api.appDictWeappFindAllByPage = () => http.get(`/api/app/dict/findAllByPage`)
/**
 * 字典-通过类型查询
 */
api.appDictFindByType = (type) => http.get(`/api/app/dict/findByType/${type}`)


export default api;